package phoenix.web.page_objects.backend;

import phoenix.core.PhoenixManager;
import phoenix.core.base.extensions.PageBaseWebExt;
import phoenix.core.data_models.PriceLinkDataModel;
import phoenix.core.data_models.PriceLinkDataModel.CreditsPrices;
import phoenix.web.locators.backend.PricePageLocators;

public class PricePage extends PageBaseWebExt
{
	public PricePage(PhoenixManager p_manager)
	{
		super(p_manager);
	}

	public PricePageLocators elements()
	{
		return new phoenix.web.locators.backend.PricePageLocators();
	}

	public void getPackagePrices(PriceLinkDataModel p_prices)
	{
		log().info("Get price 3D package...");

		wd().openURL(p_prices.three_day_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected3dPrice(wd().getText(elements().blockPrice));

		log().info("Get price 1M package...");

		wd().openURL(p_prices.one_mounth_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected1mPrice(wd().getText(elements().blockPrice));

		log().info("Get price 3M package...");

		wd().openURL(p_prices.three_mounth_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected3mPrice(wd().getText(elements().blockPrice));

		log().info("Get price 6M package...");

		wd().openURL(p_prices.six_mounth_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected6mPrice(wd().getText(elements().blockPrice));

	}

	public void getFeaturesPrices(PriceLinkDataModel p_prices)
	{
		log().info("Get price vip_in_search package...");

		wd().openURL(p_prices.vip_in_search_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpectedVipPrice(wd().getText(elements().blockPrice));

		log().info("Get price free_communicate_gbr_backend_link package...");

		wd().openURL(p_prices.free_communicate_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpectedFreeCommunicatePrice(wd().getText(elements().blockPrice));

		log().info("Get price free_communicate_gbr_backend_link package...");

		wd().openURL(p_prices.full_upgrade_backend_link);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpectedFullUpgradePrice(wd().getText(elements().blockPrice));
	}

	public void getCreditsExpected(CreditsPrices p_prices)
	{
		log().info("Get price 20_credits...");

		wd().openURL(p_prices.backend_link_20_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected20(wd().getText(elements().blockPrice));

		log().info("Get price 40_credits...");

		wd().openURL(p_prices.backend_link_40_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected40(wd().getText(elements().blockPrice));

		log().info("Get price 80_credits...");

		wd().openURL(p_prices.backend_link_80_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected80(wd().getText(elements().blockPrice));

		log().info("Get price 160_credits...");

		wd().openURL(p_prices.backend_link_160_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected160(wd().getText(elements().blockPrice));

		log().info("Get price 320_credits...");

		wd().openURL(p_prices.backend_link_320_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected320(wd().getText(elements().blockPrice));

		log().info("Get price 500_credits...");

		wd().openURL(p_prices.backend_link_500_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected500(wd().getText(elements().blockPrice));

		log().info("Get price 1000_credits...");

		wd().openURL(p_prices.backend_link_1000_credits);
		wd().waitForVisibility(elements().blockPrice, "Price block doesn't visible!");
		p_prices.setExpected1000(wd().getText(elements().blockPrice));
	}
}
